﻿<local:ViewBase x:Class="MVVMLab.LabContactView" 
                xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
                xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
                xmlns:sys="clr-namespace:System;assembly=mscorlib"
                xmlns:local="clr-namespace:MVVMLab">
    
    <local:ViewBase.Resources>
        <ControlTemplate x:Key="validationTemplate">
            <DockPanel>
                <TextBlock Margin="5,0,5,0" Foreground="Red" FontSize="16" VerticalAlignment="Center" Text="*" ToolTip="{Binding ElementName=errorAdorner, Path=AdornedElement.(Validation.Errors)[0].ErrorContent}" />
                <AdornedElementPlaceholder x:Name="errorAdorner" />
            </DockPanel>
        </ControlTemplate>

        <Style TargetType="{x:Type TextBox}">
            <Setter Property="Validation.ErrorTemplate" Value="{DynamicResource validationTemplate}" />
        </Style>

    </local:ViewBase.Resources>
    <Grid>

        <Border Margin="11" BorderBrush="LightGray" BorderThickness="1" CornerRadius="10" Padding="10">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="140" />
                    <ColumnDefinition Width="160" />
                    <ColumnDefinition Width="155" />
                </Grid.ColumnDefinitions>

                <TextBlock Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Text="Contact Maintenance" FontWeight="Bold" Margin="0,7" FontSize="14" />
                <Label Grid.Column="0" Grid.Row="1" Content="First Name" />
                <Label Grid.Column="0" Grid.Row="2" Content="Last Name" />
                <Label Grid.Column="0" Grid.Row="3" Content="Birthday" />
                <Label Grid.Column="0" Grid.Row="4" Content="Number Of Computers" />

                <!-- beginpaste here -->
                <!-- FirstName -->
                <TextBox Grid.Column="1" Grid.Row="1" Text="" Width="150" MaxLength="30" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <!-- LastName -->
                <TextBox Grid.Column="1" Grid.Row="2" Text="" Width="150" MaxLength="30" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <!-- Birthday -->
                <TextBox Grid.Column="1" Grid.Row="3" Text="" Width="100" MaxLength="10" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <!-- NumberOfComputers -->
                <TextBox Grid.Column="1" Grid.Row="4" Text="" Width="50" MaxLength="2" HorizontalAlignment="Left" VerticalAlignment="Top" />

                <TextBlock Grid.Column="2" Grid.Row="1" Text="" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBlock Grid.Column="2" Grid.Row="2" Text="" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBlock Grid.Column="2" Grid.Row="3" Text="" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBlock Grid.Column="2" Grid.Row="4" Text="" HorizontalAlignment="Left" VerticalAlignment="Top" />

                <!-- end paste here -->
                
                
                <Grid Grid.Column="0" Grid.Row="5" Grid.ColumnSpan="2" Grid.IsSharedSizeScope="True" HorizontalAlignment="Right">
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition SharedSizeGroup="Buttons" />
                        <ColumnDefinition SharedSizeGroup="Buttons" />
                    </Grid.ColumnDefinitions>
                    <Button Command="{Binding Path=NewCommand}" Content="New" Padding="3.5,0,3.5,0" Margin="3.5" />
                    <Button Command="{Binding Path=SaveCommand}" Content="Save" Padding="3.5,0,3.5,0" Grid.Column="1" Margin="3.5" />
                </Grid>

            </Grid>
        </Border>

    </Grid>
</local:ViewBase>

    <!-- 
        
                <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding Path=LabContact.FirstName, Mode=TwoWay, UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" Width="150" MaxLength="30" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding Path=LabContact.LastName, Mode=TwoWay, UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" Width="150" MaxLength="30" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding Path=LabContact.Birthday, Mode=TwoWay, UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True, TargetNullValue={x:Static sys:String.Empty}, StringFormat=d}" HorizontalAlignment="Left" Width="150" MaxLength="10" />
                <TextBox Grid.Column="1" Grid.Row="4" Text="{Binding Path=LabContact.NumberOfComputers, Mode=TwoWay, UpdateSourceTrigger=LostFocus, NotifyOnValidationError=True, ValidatesOnDataErrors=True, ValidatesOnExceptions=True}" Width="50" MaxLength="2" HorizontalAlignment="Left" VerticalAlignment="Top" />

                <TextBlock Grid.Column="2" Grid.Row="1" Text="{Binding Path=LabContact.FirstName}" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBlock Grid.Column="2" Grid.Row="2" Text="{Binding Path=LabContact.LastName}" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBlock Grid.Column="2" Grid.Row="3" Text="{Binding Path=LabContact.Birthday, StringFormat=\{0:d\}}" HorizontalAlignment="Left" VerticalAlignment="Top" />
                <TextBlock Grid.Column="2" Grid.Row="4" Text="{Binding Path=LabContact.NumberOfComputers}" HorizontalAlignment="Left" VerticalAlignment="Top" />
   
        
        -->